package com.blog.service.impl;

import com.blog.bean.StayWord;
import com.blog.mapper.StayWordMapper;
import com.blog.service.StayWordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class StayWordServiceImpl implements StayWordService {

    @Resource
    private StayWordMapper stayWordMapper;

    @Override
    public int deleteByPrimaryKey(Long stayWordId) {
        return stayWordMapper.deleteByPrimaryKey(stayWordId);
    }

    @Override
    public int insert(StayWord stayWord) {
        return stayWordMapper.insert(stayWord);
    }

    @Override
    public int insertSelective(StayWord stayWord) {
        return stayWordMapper.insertSelective(stayWord);
    }

    @Override
    public StayWord selectByPrimaryKey(Long stayWordId) {
        return stayWordMapper.selectByPrimaryKey(stayWordId);
    }

    @Override
    public int updateByPrimaryKeySelective(StayWord stayWord) {
        return stayWordMapper.updateByPrimaryKeySelective(stayWord);
    }

    @Override
    public int updateByPrimaryKeyWithBLOBs(StayWord stayWord) {
        return stayWordMapper.updateByPrimaryKeyWithBLOBs(stayWord);
    }

    @Override
    public int updateByPrimaryKey(StayWord stayWord) {
        return stayWordMapper.updateByPrimaryKey(stayWord);
    }

    @Override
    public List<StayWord> selectStayWord(StayWord stayWord) {
        return stayWordMapper.selectStayWord(stayWord);
    }

    @Override
    public StayWord getStayWord(StayWord stayWord) {
        List<StayWord> list = this.selectStayWord(stayWord);
        if (list == null || list.isEmpty()) {
            return null;
        }
        return list.get(0);
    }
}
